{extend name="base" /}
{block name="title"}保险录入{/block}
{block name="bread"}
<div class="bread-cram">
    <div class="bread-cram-inner">
        <span class="title">保险公司使用</span>
        <span class='sub-title'>- 保险录入</span>
    </div>
</div>
{/block}
{block name="static"}
<link rel="stylesheet" type="text/css" media="screen" href="/static/pc/css/selectordie.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="/static/pc/css/selectordie_theme_01.css"/>
{/block}


{block name="main"}
              <div class="menu-content left">
                  <div class="menu-content-title">
                      <p>资料录入</p>
                  </div>
                  <div class="step-box">
                      <div class="active">保单险种</div>
                      <div class="active">货品信息</div>
                      <div>货品受损</div>
                      <div>货品现状</div>
                      <div>物权信息</div>
                      <div>递交授权</div>
                  </div>
                  <div class="msg-tip" style="text-align: center">
                        *以下资料作为法律责任依据请如实填写,<a>查看模板>></a>
                  </div>
                  <div class="form-box">
                    <div class="form-content">

                        <div class="form-item">
                            <label>货品类别：</label>
                            <select class="myselect">
                                {volist name="list" id="vo"}
                                <option value="{$vo.gt_id}">{$vo.gt_name}</option>
                                {/volist}
                            </select>
                        </div>
                      <div class="form-item">
                        <label>货品名称：</label>
                        <input type="text" placeholder="请填写货品名称" name="goods_name"/>
                      </div>
                      <div class="form-item">
                        <label>数量与规格：</label>
                        <input type="text" placeholder="请填写数量与规格" name="goods_num"/>
                      </div>
                      <div class="form-item">
                        <label>货物原值：</label>
                        <input type="text" placeholder="请填写" class='price' name="good_price"/>
                        万元
                      </div>
                      <div class="form-item">
                        <label>评估价：</label>
                        <input type="text" placeholder="请填写" class='price' name="good_pg_price"/>
                        万元
                      </div>
                        <div class="form-item">
                            <p style="color: red">注：评估价将作为起拍价使用</p>
                        </div>
                    </div>

                    <div class="form-footer">
                      <div class="step-btn-box">
                        <div class="pre-btn" onclick="javascript:history.go(-1);">上一步</div>
                        <div class="next-btn">下一步</div>
                      </div>
                    </div>
                  </div>
              </div>
<input type="hidden" value="{$policy_num}" name ='policy_num'>
{/block}


{block name="js"}
<script type='text/javascript' src='/static/pc/js/selectordie.min.js' charset='utf-8'></script>
<script type="text/javascript">
    $(function() {
        $('.myselect').selectOrDie();
        $('.next-btn').on('click', function () {
            var poliecy = $("input[ name='policy_num']").val();
            var goods_name = $("input[ name='goods_name']").val();
            var goods_num = $("input[ name='goods_num']").val();
            var good_price = $("input[ name='good_price']").val();
            var good_pg_price = $("input[ name='good_pg_price']").val();
            var goods_type = $(".myselect").val();

            if (goods_type.length == 0) {
                layer.msg('请选择货品类别', {icon: 2});
                return;
            }
            if (goods_name.length == 0) {
                layer.msg('请填写货品名称', {icon: 2});
                return;
            }
            if (goods_num.length == 0) {
                layer.msg('请填写数量与规格', {icon: 2});
                return;
            }
            if (good_price.length == 0) {
                layer.msg('请填写物品原值', {icon: 2});
                return;
            }
            if (good_pg_price.length == 0) {
                layer.msg('请填写物品原值', {icon: 2});
                return;
            }
            $.ajax({
                type: 'POST',
                url: "{:url('insurer/addInsurer')}",
                data: {
                    'policy_num':poliecy,
                    'goods_type': goods_type,
                    'goods_name': goods_name,
                    'goods_num': goods_num,
                    'good_price': good_price,
                    'good_pg_price': good_pg_price,
                    'now_status':2
                },
                dataType: 'json',
                success: function (Json) {
                    if (Json.code == 200) {
                        location.href="{:url('insurer/step3')}?policy_num="+poliecy;
                    } else {
                        layer.msg('保存失败', {icon: 2});
                    }
                }
            });



        });
    });


</script>
{/block}